<template>
  <div class="header" id="header">
    <div class="head-text">
      <p>天道酬勤 恒者必胜 同舟共济 劈浪向前</p>
    </div>
    <div class="father-head">
      <div class="son-head">
        <div class="logo">
          <a href="/home"><img src="../assets/img/logo.png" alt=""></a>
        </div>
        <div class="son-head-main">
          <router-link to="/home">首页</router-link>
          <router-link to="/news">新闻</router-link>
          <router-link to="/project">项目</router-link>
          <router-link to="/member">成员</router-link>
          <router-link to="/mien">风采</router-link>
          <router-link to="/about">关于我们</router-link>
          <a id="link" @click="erlink">加入我们</a>
        </div>
        <!--        -->
        <!-- 遮盖层 -->

      </div>
    </div>
    <div class="min-header" style="display: none">
      <div class="min-header-son">
        <div class="logo">
          <a href="/home"><img src="../assets/img/logo.png" alt=""></a>
        </div>
        <div class="text">
          旗帜软件工作室
        </div>
        <div class="menu" @click="minnevClick">
          <i class="glyphicon glyphicon-menu-hamburger"></i>
        </div>

      </div>
      <div class="min-header-nev">
        <router-link to="/home">首页</router-link>
        <router-link to="/news">新闻</router-link>
        <router-link to="/project">项目</router-link>
        <router-link to="/member">成员</router-link>
        <router-link to="/mien">风采</router-link>
        <router-link to="/about">关于我们</router-link>
        <a id="minlink" @click="erlink">加入我们</a>
        <!--          <a href="/home">首页</a>-->
        <!--          <a href="/news">新闻</a>-->
        <!--          <a href="/project">项目</a>-->
        <!--          <a href="/member">成员</a>-->
        <!--          <a href="/mien">风采</a>-->
        <!--          <a href="/about">关于我们</a>-->
        <!--          <a id="link" @click="erlink">加入我们</a>-->
      </div>

    </div>
    <div class="cover"></div>
    <div class="code">
      <div class="code-header">
        <span class="title">Banner欢迎你</span>
        <button id="closeBtn" type="button" class="close" aria-label="Close"><span aria-hidden="true" @click="offlink">&times;</span>
        </button>
      </div>

      <div class="code-body">
        <div class="code-code">
          <div class="code-img">
            <!--                                <img :src='codeOne' alt="">-->
            <img :src='this.$store.state. photo1' alt="">

          </div>
          <div class="code-title"><p>{{ this.$store.state.photo1text }}</p></div>
          <!--                            <div class="code-title"><p>{{erwm[0].photoName}}}</p></div>-->

        </div>
        <div class="code-code">
          <div class="code-img">
            <!--                                <img :src='codeTwo' alt="">-->
            <img :src='this.$store.state. photo2' alt="">
          </div>
          <div class="code-title"><p>{{ this.$store.state.photo2text }}</p></div>
        </div>
      </div>


    </div>

  </div>

</template>

<script>
export default {
  name: "Header",
  data() {
    return {
      minnev: false
    }
  },
  methods: {
    // 打开加入我们按钮
    erlink() {
      let owidth = ($(window).width());
      if (owidth < 851) {
        // 先恢复移动端导航栏
        this.minnev = !this.minnev;
        $(".min-header-nev").hide();
        $(".min-header").toggleClass("min-header-color")
        $(".menu>i").removeClass().toggleClass("glyphicon glyphicon-menu-hamburger")
        $(".menu").css("color", "white")
      }
      $(".code").show(500);
      $(".cover").show();
      this.$axios({
        url: '/officialwebsite/qrCodeFrontDesk/selectAll',
        method: 'get',
      }).then(res => {
        this.$store.state.photo1 = res.obj[0].photoAddress
        this.$store.state.photo2 = res.obj[1].photoAddress
        this.$store.state.photo1text = res.obj[0].photoName
        this.$store.state.photo2text = res.obj[1].photoName
      })
    },
    // 关闭加入我们按钮
    offlink() {
      $(".code").hide(500);
      $(".cover").hide();
    },
    // 移动端打开导航
    minnevClick() {
      this.minnev = !this.minnev;
      if (this.minnev) {
        $(".cover").show();
        $(".menu>i").removeClass().toggleClass("glyphicon glyphicon-remove")
        $(".menu").css("color", "black")
        $(".min-header-nev").show();
        $(".min-header").toggleClass("min-header-color")
      } else {
        $(".min-header-nev").hide();
        $(".min-header").toggleClass("min-header-color")
        $(".menu>i").removeClass().toggleClass("glyphicon glyphicon-menu-hamburger")
        $(".menu").css("color", "white")
        $(".cover").hide();
      }

    }
  },
}
</script>

<style lang="less" scoped>
//@import "../assets/css/base.css";
#link {
  cursor: pointer;
}

.header {
  position: fixed;
  left: 0%;
  top: 0;
  right: 0%;
  z-index: 999;
}

.head-text {
  text-align: center;
  height: 45px;
  background-color: #94070a;

  p {
    line-height: 45px;
    font-family: "微软雅黑";
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 20px;
    color: #d39797;
    word-spacing: 30px;
  }
}

.father-head {
  height: 85px;
  background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
}

.min-header {
  height: 60px;
  background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));

  .min-header-son {
    width: 95%;
    position: relative;
    display: flex;
    height: 100%;
    /*垂直居中*/
    align-items: center;
    /*flex布局居中*/
    justify-content: space-between;
    margin: auto;
  }

  .logo {
    height: 100%;
    width: 10%;

    img {
      margin-top: 2px;
      width: 50px;
      height: 50px;
    }
  }

  .text {
    text-align: center;
    width: 70%;
    color: white;
    font-weight: 300;
    font-size: 18px;
    margin-top: -8px;
  }

  .menu {
    cursor: pointer;
    width: 10%;
    color: white;
    font-size: 30px;

  }

  .min-header-nev {
    //transition: all 0.4s ease-out 0s;
    width: 100%;
    height: 150px;
    background-color: white;
    position: fixed;
    left: 0%;
    top: 60px;
    right: 0%;
    z-index: 2;
    display: none;

    a {
      border: 1px solid rgba(0, 0, 0, 0.08);
      line-height: 35px;
      color: black;
      height: 25%;
      display: inline-block;
      width: 50%;
      text-align: center;
    }
  }
}

.min-header-color {
  background: 0;
  background-color: white !important;
}

.son-head {
  position: relative;
  display: flex;
  height: 100%;
  /*垂直居中*/
  align-items: center;
  /*flex布局居中*/
  justify-content: center;
  margin: auto;

  .logo {
    height: 100%;
    width: 150px;

    img {
      width: 100px;
      height: 100px;
      margin-top: -5px;
    }
  }
}

.son-head-main {
  text-align: center;
  font-size: 18px;

  a {
    margin: 0 25px;
    color: #fff;
    display: inline-block;
    position: relative;
  }

  a:hover {
    color: #fee082;
    text-decoration: none;
  }
}

.code {
  text-align: center;
  /* 先默认隐藏 */
  display: none;
  /* 利用固定定位实现盒子水平垂直居中 */
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  min-height: 350px;
  background-color: #ffffff;
  /* 边框阴影 */
  box-shadow: 0px 0px 20px #fff;
  /* 遮盖层用的也是固定定位，这里使login的z-index大于遮盖层的
  使login显示在遮盖层上边 */
  border-radius: 15px;
  z-index: 1;

  .code-header {
    height: 40px;

    .title {
      line-height: 70px;
      margin-left: 6px;
      font-size: 24px;
      color: rgba(231, 183, 16, 0.93);
      font-family: "微软雅黑";
    }

    .close {
      font-size: 30px;
      padding-right: 6px;
    }
  }

  .code-body {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    //width: 600px;
    height: 85%;

    .code-code {
      //flex: 1;
      width: 300px;
      //height: 100%;
      //background-color: #d39797;
      .code-img {
        width: 240px;
        height: 240px;
        margin: auto;
        //margin: 0px 0px -10px 30px;
        //background-color: #94070a;
        img {
          box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
          width: 80%;
          height: 80%;
          margin: 10% 10%;

        }
      }

      .code-title {
        width: 180px;
        height: 40px;
        margin: 0 auto;
        //border: #0072d8;
        //background-color: #0072d8;
        line-height: 35px;
        text-align: center;
        border-radius: 10px;
        color: black;
        border-bottom: 2px solid #4c4c4c;
        border-top: 3px solid #00b9b7;

        p {
          font-size: 18px;
          -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), color-stop(50%, rgba(0, 0, 0, 1)), to(rgba(0, 0, 0, 0)));

        }
      }
    }
  }
}

/* 遮盖层 */

.cover {
  background-color: rgba(0, 0, 0, .3);
  display: none;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0px;
  left: 0px;
}
@media screen and (max-width: 750px) {
  .head-text {
    display: none;
  }
}
@media screen and (max-width: 850px) {


  .father-head {
    display: none;
  }

  .min-header {
    display: block !important;
  }

  .cover {
    top: 60px;
  }

  .code {
    top: 50%;
    width: 300px;
    z-index: 3;

    .code-header {
      height: 20px !important;

      .title {
        line-height: 50px;
        font-size: 18px !important;
      }
    }

    .code-code {
      .code-img {
        width: 200px !important;
        height: 200px !important;
      }

      .code-title {
        width: 170px !important;

        p {
          font-size: 14px !important;

        }
      }
    }

  }
}
</style>
